#ifndef PLAYER_H
#define PLAYER_H

#include "iportablesocket.h"
#include "circularbuffer.h"
#include "poolTime.h"


class protocol;

class Player
{

public:
    Player(unsigned int readCirbufSize = 4096, unsigned int writeCirbufSize = 4096);
    Player(PortableSocket *sock, unsigned int readCirbufSize = 4096, unsigned int writeCirbufSize = 4096);

    CircularBuffer	*getReadBuffer();
    CircularBuffer	*getWriteBuffer();
    PortableSocket	*getSocket();
    int			getId() const;
    std::string		getIp() const;
    bool	       	isManager() const;
    bool		isReady() const;
    bool		isAway() const;
    std::string const	&getName() const;
    protocol		*getProto();
    
    void setSocket(PortableSocket *sock);
    void setName(std::string const &);
    void setId(int id);
    void setManager(bool m);
    void setReady(bool r);
    void setAway(bool a);
    void setIp(std::string const &s);

protected:
    bool		_away;

    bool	       	_manager;
    bool		_ready;
    int			_id;
    std::string		_name;
    std::string		_ip;
    PortableSocket	*_socket;
    CircularBuffer	_readBuf;
    CircularBuffer	_writeBuf;
    protocol		*_proto;
    poolTime		*_poolTime;
};

extern int incPlayer;

#endif
